﻿//-----------------------------------------------------------------------
// <copyright file="ICommunicationBus.cs" company="WpfDevelopment.com">
//     Copyright WpfDevelopment.com. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace WpfDevelopment.MVVM
{
    using System;
    using System.Diagnostics.Contracts;

    /// <summary>
    /// The interface for a service bus to communicate over
    /// </summary>
    [ContractClass(typeof(ICommunicationBusContract))]
    public interface ICommunicationBus
    {
        /// <summary>
        /// Notifies the specified message.
        /// </summary>
        /// <typeparam name="T">Type of message to send</typeparam>
        /// <param name="message">The message.</param>
        /// <param name="parameter">The parameter.</param>
        void Notify<T>(T message, object parameter);

        /// <summary>
        /// Registers the specified callback.
        /// </summary>
        /// <typeparam name="T">Type of message to register for</typeparam>
        /// <param name="message">The message.</param>
        /// <param name="callback">The callback.</param>
        void Register<T>(T message, Action<object> callback);
    }
}
